package com.huluobo.roomdemo;

import androidx.room.Entity;
import androidx.room.PrimaryKey;

/**
 * Created by LC on 2024/9/20.
 * Room数据库中的表,就是Bean类本身,需要加一个注解
 * Entity(tableName = "user_info")  标记一个类是一个表,tableName是重命名的表名,如果不重命名,就是类本身的名字
 * PrimaryKey(autoGenerate = true) 标记一个字段为主键, autoGenerate 自增,一般自增的属性不要放到构造方法中
 */
@Entity(tableName = "user_info")
public class UserBean {
    private String username;
    private String password;
    @PrimaryKey(autoGenerate = true)
    private int userId;

    public UserBean(String username, String password) {
        this.username = username;
        this.password = password;
    }

    @Override
    public String toString() {
        return "UserBean{" +
                "username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", userId=" + userId +
                '}';
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }
}
